package com.example.rabbitmq.example.spring;

import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.messaging.handler.annotation.Payload;
import org.springframework.stereotype.Component;

@Component
public class MessageListener {

    /**
     * 可以有很多参数
     * Channel Message @PayLoad @Header @Headers  MessageHeaders
     * MessageHeaderAccessor  AmqpMessageHeaderAccessor
     */
    @RabbitListener(queues = "queue.anno")
    public void message(@Payload String message){
        System.out.println(message);
    }
}
